Skip to content

workspace: allow unused_workspace_dependencies in the Cargo lint table - #1269

Open
dotCooCoo wants to merge 1 commit into
storytold:mainfrom
dotCooCoo:fix/workspace-cargo-lint-table
Open

dotCooCoo wants to merge 1 commit into
storytold:mainfrom
dotCooCoo:fix/workspace-cargo-lint-table

Conversation

@dotCooCoo

@dotCooCoo dotCooCoo commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

unused_workspace_dependencies is a Cargo lint, but the root Cargo.toml set it under [workspace.lints.rust] and [workspace.lints.clippy]. Cargo passed those entries to rustc and Clippy as -A unused_workspace_dependencies and -A clippy::unused_workspace_dependencies, and every crate reported warning[E0602]: unknown lint. The [lints] entry in .cargo/config.toml did not set the level either: Cargo 1.100 still printed 73 "unused workspace dependency" warnings.

This moves the allow into a new [workspace.lints.cargo] table and removes it from the rust and clippy tables. Cargo's lint reference says "Cargo lints can be configured in the [lints.cargo] table of the Cargo.toml manifest" (https://doc.rust-lang.org/cargo/reference/lints.html#unused_workspace_dependencies), and members inherit workspace.lints through [lints] workspace = true (https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table). All 133 crates/*/Cargo.toml files keep [lints] workspace = true. .cargo/config.toml, which held only that [lints] entry, is removed.

Cargo 1.95 (the workspace rust-version) accepts the table but prints unused manifest key lints.cargo once per manifest, since [lints.cargo] was stabilized in Cargo 1.100 (https://doc.rust-lang.org/cargo/reference/unstable.html#lintscargo). The MSRV job runs cargo check without -D warnings, so it still passes.

Testing

Base: b77af389, which is current main; the branch merges into it cleanly.

  • cargo check --workspace --tests --locked (Cargo 1.100.0), before: 73 unused workspace dependency warnings, and 397 compiled targets (lib, test and build-script units) each reported the E0602 warning. After: none of either; the other warnings are unchanged.
  • cargo clippy --workspace --all-targets --locked -- -D warnings (1.100.0): passes, no E0602.
  • cargo check --workspace --lib --all-features --locked (1.95.0): passes, no E0602, 135 unused manifest key lints.cargo warnings.
  • cargo fmt --all -- --check: passes.
  • No test is added: the change is manifest configuration, and the check output above shows its effect.
  • The Workspace workflow's clippy and test runs, on Linux, Windows and macOS, run in this pull request's CI.

Summary by CodeRabbit

  • Chores
    • Updated workspace lint configuration and removed a redundant Cargo configuration file. These changes affect project checks and configuration only; no changes to the application’s user-facing features or behavior.

unused_workspace_dependencies is a Cargo lint, so its level belongs in
[workspace.lints.cargo]. Under [workspace.lints.rust] and
[workspace.lints.clippy], Cargo passed it to rustc and Clippy as
-A unused_workspace_dependencies and -A clippy::unused_workspace_dependencies,
which each crate reported as E0602 (unknown lint). The [lints] entry in
.cargo/config.toml did not set the level either, so Cargo 1.100 still
printed 73 "unused workspace dependency" warnings for the workspace.

The allow now sits in [workspace.lints.cargo], which every member
inherits through [lints] workspace = true, and .cargo/config.toml is
removed. On Cargo 1.100, cargo check --workspace --tests prints no E0602
and no unused workspace dependency warnings. Cargo 1.95 accepts the table
but reports lints.cargo as an unused manifest key.

https://doc.rust-lang.org/cargo/reference/lints.html#unused_workspace_dependencies
https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The unused workspace dependencies lint allowance moves from .cargo/config.toml to the [workspace.lints.cargo] section in Cargo.toml. The Rust and Clippy lint sections remain.

Changes: Cargo lint configuration

Layer / File(s) Summary
Move workspace dependency lint allowance
.cargo/config.toml, Cargo.toml
unused_workspace_dependencies = "allow" moves from [workspace.lints.clippy] to [workspace.lints.cargo]. The .cargo/config.toml file is deleted.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: dylanmtaylor

Merge Risk: Minimal · up to 5f698

This change only adjusts lint configuration and does not affect runtime behavior. Older Cargo versions may print warnings about an unused manifest key, but builds should not fail.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: moving unused_workspace_dependencies to the Cargo lint table (workspace.lints.cargo). The raw summary confirms the Cargo.toml change moves that setting from workspace.…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: moving unused_workspace_dependencies to the Cargo lint table (workspace.lints.cargo). The raw summary confirms the Cargo.toml change moves that setting from workspace.lints.clippy to workspace.lints.cargo, and the PR objectives confirm removal of .cargo/config.toml. The title omits the config file removal, which is an acceptable omission. The title is specific and matches the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b77af38 and 5f6984a.

Files selected for processing: 2

  • .cargo/config.toml
  • Cargo.toml
Files with no reviewable changes: 1

  • .cargo/config.toml

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant